package com.pet;

import java.util.Objects;
import java.util.Scanner;

public class pet {
    int age;
    String name;
    String variety;
    float love;
    float satiety;


    public void getProfile(){
        System.out.println("名字："+name);
        System.out.println("年龄："+age);
        System.out.println("品种："+variety);
        System.out.println("好感度："+love);
        System.out.println("饱食度："+satiety);
    }
    public boolean play(boolean b){
        System.out.println("输入1抚摸，输入2喂食，输入3退出");

        //输入键位
        Scanner scan=new Scanner(System.in);
        String str=scan.next();

        //操作
        if(Objects.equals(str, "1")){
            this.love+=10;
        }
        if(Objects.equals(str, "2")){
            if(this.satiety>90){
                System.out.println("宠物已经吃饱了，不用再投喂了");
            }
            else{
                this.satiety+=10;
            }
        }
        if(Objects.equals(str, "3")) {
            b=false;
            System.out.println("游戏已退出");

        }
        return b;
    }
}
